//
//  SSHandPickViewCell.m
//  starspaceVR
//
//  Created by 曹端芹 on 17/9/13.
//  Copyright © 2017年 starspace. All rights reserved.
//

#import "SSHandPickViewCell.h"

#define pictureURL @"http://www.vrspaces.cn"

@interface SSHandPickViewCell ()

@property (nonatomic,strong) UIImageView *iconImgView;
@property (nonatomic,strong) UILabel *titleL;

@end

@implementation SSHandPickViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self.contentView addSubview:self.iconImgView];
        [self.contentView addSubview:self.titleL];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;

}

- (void)setModel:(SSHandpickModel *)model {
    _model = model;
    NSString *imageURLString = [NSString stringWithFormat:@"%@%@",pictureURL,model.src];
    [self.iconImgView sd_setImageWithURL:[NSURL URLWithString:imageURLString] placeholderImage:[UIImage imageNamed:placeholderImageName]];
    self.titleL.text = model.title;


}

- (void)layoutSubviews {
    
    [self.iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.right.mas_equalTo(self.contentView);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).mas_offset(-20);
    }];

    [self.titleL mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.bottom.right.mas_equalTo(self.contentView);
        make.top.mas_equalTo(self.iconImgView.mas_bottom);
    }];
    
    

}

- (UIImageView *)iconImgView {
    if (!_iconImgView) {
       _iconImgView = [[UIImageView alloc] init];
    }
    return _iconImgView;
}

- (UILabel *)titleL {
    if (!_titleL) {
        _titleL = [[UILabel alloc] init];
        _titleL.textColor = kRGBColor(38, 38, 38);
        _titleL.font = kFont(15);
    }
    return _titleL;
}

@end
